const KoaRouter = require('koa-router');
const validateUserInfo = require('../middleware/module/user/validatePassword');
const userExist = require('../middleware/module/user/userExist');
const encryptionMiddleware = require('../middleware/module/user/encryptionMiddleware');
const { registerUser, login } = require('../controller/userControllter');

const router = new KoaRouter({ prefix: '/user' });

router.post('/register', validateUserInfo, encryptionMiddleware, userExist, registerUser);
router.post('/login', validateUserInfo, login);
// router.get('/test', (ctx) => {
//     console.log('test');
//     console.log(ctx.user);
//     ctx.body = "hello"
// })

module.exports = router;
